<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Map</title>
    <script>
        window.onload = function(){


            //Map 的key可以是对象；

            var map = new Map();
            var result;
            map.set('name','hanley')
            map.set('age',20);
            map.set('gender','Man');

            map.get(key);
            map.has(key);
            map.delete(key);
            map.clear();
            map.size();

            //Map 默认值
            var m1 = new Map([['a',2],['b',3]]);
            

            //扩展运算符
            var keys = [...m1.keys()];//keys为数组
            var vals = [...m1.values()];//values为数组
            var kvs  = [...m1];//kvs 是对象数组
            var m3 = new Map(...kvs);//数组转换Map
            
            //Map转为数组
            var arry = Array.from(map);

            

        }
    </script>
</head>
<body>
    
</body>
</html>